/**      
 * @file		LinkListRunner.cpp
 * @description		This demonstrates the use of a Link List.
 *			It utilitizes the LinkList class to handle 
 *			all of the Lists functionality.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
#include "LinkList.h"
using namespace std;
using namespace CSCI123;		// notice the use of CSCI123 namespace

void emptyList(LinkList& myLinkList);

/**
 * Utilities the LinkList class.
 * @see LinkList.h and LinkList.cpp
 * @return zero if the application executes successfully
 */
int main() {
	cout << "Link List Sample\n";
	LinkList myLinkList;

	emptyList(myLinkList);

	myLinkList.insert("Brad");
	myLinkList.insert("John");
	myLinkList.insert("Sue");
	myLinkList.insert("Sara");

	emptyList(myLinkList);
	cout << "The list has " << myLinkList.getSize() << " nodes in it.\n";

	NodePtr searchNode = NULL;
	myLinkList.search(searchNode, "Sara");
	if(searchNode == NULL)
		cout << "Didn't find the string searched for\n";
	else
		cout << "Search node " << searchNode->data << " found\n";

	myLinkList.deleteNode("Sara");	// delete the first node
	myLinkList.deleteNode("Brad");  // delete the last node

	emptyList(myLinkList);
	cout << "The list has " << myLinkList.getSize() << " nodes in it.\n";

	return 0;
}

void emptyList(LinkList &myLinkList) {
	cout << "Check if the list is empty. Is it empty?  ";
	if(myLinkList.isEmpty()) {
		cout << "yes\n";
	} else {
		cout << "no\n";
	}
}
